var http = require('http');
http.createServer(onRequest).listen(8888);

// 终端打印如下信息
console.log('Server running at http://127.0.0.1:8888/');
function onRequest(req,resp){
	resp.writeHead(200,{"Content-Type":"text/plain"})
    watchReq(req,resp)

}
function watchReq(req ,resp){
    var data = ''
    req.on('data', function(chunk){
        data = chunk;
    });
    req.on('end', function(){
        var cont = data.toString()
        console.log(cont);
        var json = JSON.parse(cont);
        console.log(json.name)
        console.log(json.age)
        resp.write(cont);
        resp.end();
    });
}

